package com.lagou.bigdata.task01;

/**
 * 编程实现学生信息管理系统中字符界面层的功能
 */
public class ViewStudent {
    private StudentManager studentManager;

    public ViewStudent(StudentManager studentManager){
        this.studentManager = studentManager;
    }

    /**
     * 实现主菜单的绘制
     */
    public void showMenu() throws AgeException, StudentIdException {

        while(true){
            System.out.println("\n\n\t       学生信息管理系统");
            System.out.println("-------------------------------------------");
            System.out.print("   [1] 增加学生信息");
            System.out.println("         [2] 删除学生信息");
            System.out.print("   [3] 修改学生信息");
            System.out.println("         [4] 查找学生信息");
            System.out.print("   [5] 显示学生信息");
            System.out.println("         [0] 退出学生系统");
            System.out.println("-------------------------------------------");
            System.out.println("请选择具体的业务编号:");
            int choose = ScannerStudent.getScanner().nextInt();

            switch(choose) {
                case 1: studentManager.addStudent(); break;
                case 2: studentManager.deleteStudent(); break;
                case 3: studentManager.modifyStudent(); break;
                case 4: studentManager.searchStudent(); break;
                case 5: studentManager.printStudents(); break;
                case 0: System.out.print("谢谢使用，再见！");return;
                default:System.out.println("输入错误,请重新输入");
            }
        }
    }
}
